class Solution {
public:

    vector<vector<int>> ret;
    vector<int> path;

    vector<vector<int>> subsets(vector<int>& nums) {
        int i = 0;
        //path.reserve(1);
        dfs(nums, i);
        return ret;
    }

    void dfs(vector<int>& nums, int i)
    {
        if (i == nums.size())
        {
            ret.push_back(path);
            return;
        }


        path.push_back(nums[i]);
        dfs(nums, i + 1);
        path.pop_back();

        dfs(nums, i + 1);

    }
};


class Solution {
public:
    vector<vector<int>> ret;
    vector<int> path;
    vector<vector<int>> subsets(vector<int>& nums) {
        dfs(nums, 0);
        return ret;
    }

    void dfs(vector<int>& nums, int pos)
    {
        ret.push_back(path);
        for (int i = pos; i < nums.size(); i++)
        {
            path.push_back(nums[i]);
            dfs(nums, i + 1);
            path.pop_back();
        }
    }

};